package com.company.project.command;

import lombok.Data;

import javax.validation.constraints.Min;
@Data
public class PagingCommand {
    @Min(
            value = 1L,
            message = "页码不为小于1"
    )
    private int page = 1;
    @Min(
            value = 10L,
            message = "每页最少10条"
    )
    private int limit = 10;

    public PagingCommand() {
    }

    public int getPage() {
        return this.page;
    }

    public int getlimit() {
        return this.limit;
    }

    public void setPage(final int page) {
        this.page = page;
    }

    public void setlimit(final int limit) {
        this.limit = limit;
    }

    public boolean equals(final Object o) {
        if (o == this) {
            return true;
        } else if (!(o instanceof PagingCommand)) {
            return false;
        } else {
            PagingCommand other = (PagingCommand)o;
            if (!other.canEqual(this)) {
                return false;
            } else if (this.getPage() != other.getPage()) {
                return false;
            } else {
                return this.getlimit() == other.getlimit();
            }
        }
    }

    protected boolean canEqual(final Object other) {
        return other instanceof PagingCommand;
    }


    public String toString() {
        return "PagingCommand(page=" + this.getPage() + ", limit=" + this.getlimit() + ")";
    }
}
